package com.wl.dzt.basic.service;

import com.wl.dzt.basic.entity.BasicPortal;
import com.wl.dzt.sys.core.dao.DB;
import com.wl.dzt.sys.core.dao.JDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


/**
 * @author wl_code@163.com
 * @version 1.0
 * @date 2018/7/12/012
 * @description 快捷方式服务层
 * 
 */
@Service
@Transactional
public class BasicPortalService {

	/**
	 * 基础DAO
	 */
	@Resource
	private JDao dao;

	/**
	 * <b>改变 快捷方式顺序</b>
	 * <p>
	 * 改变 快捷方式顺序
	 * </p>
	 *
	 * @param tid
	 * @param sid
	 */
	public void changeSort(String tid, String sid) {
		BasicPortal tBasicPortal = DB.get(BasicPortal.class, tid);
		BasicPortal sBasicPortal = DB.get(BasicPortal.class, sid);
		int sort = tBasicPortal.getPortalSort();
		tBasicPortal.setPortalSort(sBasicPortal.getPortalSort());
		sBasicPortal.setPortalSort(sort);
		dao.save(tBasicPortal);
		dao.save(sBasicPortal);
	}

}
